package com.example.demo_mysql_mybatisplus.mybatisplus.entitys;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.demo_mysql_mybatisplus.mybatisplus.entitys.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

//@EqualsAndHashCode(callSuper = false)
@ToString( callSuper = true )
@Data
@Accessors(chain = true)
@TableName("user")
@NoArgsConstructor
public class User extends BaseEntity {
    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday ;

    private Integer age;

    private Integer sex;

    private String addr;

    private Long phone;


    public User(long id, String name, Integer age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }


    public static List<User> get(){
        return Arrays.asList(
                new User( 100L , "zhang1", 4 ),
                new User( 200L , "zhang2", 4 ),
                new User( 300L , "zhang2", 4 ),
                new User( 400L , "zhang3", 4 ),
                new User( 500L , "zhang3", 3 ),
                new User( 600L , "zhang3", 3 ),
                new User( 700L , "zhang4", 3 ),
                new User( 800L , "zhang4", 2 ),
                new User( 900L , "zhang4", 2 ),
                new User(1000L , "zhang4", 1 )
        );
    }
}
